<template>
        <dialogs 
        :title="title" 
        :visible.sync="dialogVisible" 
        confirmText="保存"
        width="400px">
            <el-form :model="formData" :inline="true" class="search-form-inline" label-width="120px">
                <el-form-item label="店铺">
                    <el-select v-model="formData.store">
                        <el-option value=""></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="运费">
                    <el-input v-model="formData.name"></el-input>
                </el-form-item>
                <el-form-item label="免运费下单金额">
                    <el-input v-model="formData.name"></el-input>
                </el-form-item>
            </el-form>
        </dialogs>
</template>
<script>
    import apisOrder from '@/api/orders/orders'
    export default {
        name: 'dialogEditFreight',
        props: {
            dialogVisible: {
                type: Object,
                default () {
                    return {
                        show: false
                    }
                }
            }
        },
        data() {
            return {
                row: '',
                title: '新增',
                formData: {
                    id: '',
                    remark: '',
                    store: ''
                }
            }
        },
        methods: {
            open(row) {
                this.dialogVisible.show = true
                if (row) {
                    this.title = '修改'
                    this.formData.id = row.id
                    apisOrder.getRemarkDetail(this.formData).then(res => {
                        this.formData.remark = res.data.remark
                    })
                } else {
                    this.title = '新增'
                    Object.keys(this.formData).forEach(key=>{
                        this.formData[key] = ''
                    })
                }
            },
            saveRemark() {
                let that = this
                apisOrder.editRemark(that.formData).then(res => {
                    that.dialogVisible.show = false
                    that.$emit('getList')
                })
            }
        }
    }
</script>

<style scoped>

</style>
